/*!
 * \file tfrlog_open.c
 *
 * All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.\n
 *
 * \version 3.0
 * \author geyh
 * \date 2016/03/31
 *
 */
#include <CUnit/Basic.h>
#include <stdlib.h>

#include "frcomm.h"
#include "frmem.h"
#include "frlog.h"
#include "conntrack.h"
#include "frct_comm.h"

#include "apmtest_comm.h"

static int __suite_init(void)
{

    return 0;
}

static int __suite_cleanup(void)
{

    return 0;
}


static void __case1(void)
{
    const char *p_conf_file = NULL;
    const char *p_cat = (const char *)"apm_format";
    int i_ret = 0;
    i_ret = frlog_open(p_conf_file, p_cat);

    CU_ASSERT_EQUAL(i_ret,0);
    frlog_close();
    return;
}

static void __case2(void)
{
    const char *p_conf_file = (const char *)"t_frlog/conf/zlog.conf";
    const char *p_cat = NULL;
    int i_ret = 0;
    i_ret = frlog_open(p_conf_file, p_cat);

    CU_ASSERT_EQUAL(i_ret,-1);
    frlog_close();
    return;
}



static void __case3(void)
{
    const char *p_conf_file = (const char *)"t_frlog/conf/zlog.conf";
    const char *p_cat = (const char *)"apm_format";
    int i_ret = 0;
    i_ret = frlog_open(p_conf_file, p_cat);

    CU_ASSERT_EQUAL(i_ret,0);
    frlog_close();
    return;
}

int add_suite_frlog_open(void)
{
    CU_pSuite pSuite = NULL;

    if ((pSuite = CU_add_suite("frcomm frlog_open()", __suite_init, __suite_cleanup)) == NULL)
        return FR_FAIL;

    CU_add_test(pSuite, "case1", __case1);
    CU_add_test(pSuite, "case2", __case2);
    CU_add_test(pSuite, "case3", __case3);

    return FR_SUCC;
}
